/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.vs.kindlecoll.UI;

import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import javax.swing.JList;
import javax.swing.JTree;

/**
 *
 * @author volodymyr.sadovyy
 */
class ListTreeSelection implements FocusListener {

    public ListTreeSelection() {
    }

    public void focusGained(FocusEvent e) {
    }

    public void focusLost(FocusEvent e) {
        if (null != e.getOppositeComponent() 
                && e.getOppositeComponent().getClass().equals(JTree.class)) {
            ((JList) e.getComponent()).clearSelection();
        }else if (null != e.getOppositeComponent() 
                && e.getOppositeComponent().getClass().equals(JList.class)){
            ((JTree) e.getComponent()).clearSelection();
        }
    }
}
